﻿using UtilZ.Dotnet.AudioPlayer.Native;

namespace UtilZ.Dotnet.AudioPlayer.Core
{
    /// <summary>
    /// BASS_MIX辅助类
    /// </summary>
    public class BASS_MIXHelper
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="handle">通道句柄</param>
        /// <param name="channel">通道数</param>
        /// <param name="flags">标识</param>
        /// <param name="start">开始公交车</param>
        /// <param name="length">数据长度</param>
        /// <returns></returns>
        public static bool Mixer_StreamAddChannelEx(int handle, int channel, BASSFlag flags, long start, long length)
        {
            return BASS_MIXNativeMethods.BASS_Mixer_StreamAddChannelEx(handle, channel, flags, start, length);
        }


        /// <summary>
        ///  音频源转换目标
        /// </summary>
        /// <param name="sample">目标采样率</param>
        /// <param name="chan">目标通道</param>
        /// <param name="bassFlag">BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_MIXER_END</param>
        /// <returns></returns>
        public static int MixerStreamCreate(int sample, int chan, BASSFlag bassFlag = BASSFlag.BASS_STREAM_DECODE | BASSFlag.BASS_MIXER_END)
        {
            int result = BASS_MIXNativeMethods.BASS_Mixer_StreamCreate(sample, chan, bassFlag);
            return result;
        }

        /// <summary>
        /// 音频源转采样率
        /// </summary>
        /// <param name="mixS">目标句柄</param>
        /// <param name="chan">源句柄</param>
        /// <param name="bassFlag"></param>
        /// <returns></returns>
        public static bool MixerStreamAddChannel(int mixS, int chan, BASSFlag bassFlag = BASSFlag.BASS_DEFAULT)
        {
            bool result = BASS_MIXNativeMethods.BASS_Mixer_StreamAddChannel(mixS, chan, bassFlag);
            return result;
        }
    }
}
